package casa.depesos.app.com.http.req;


import casa.depesos.app.com.http.HttpReq;
import casa.depesos.app.com.http.Req;
import casa.depesos.app.com.http.ReqCallback;
import casa.depesos.app.com.http.bean.BannerBean;
import casa.depesos.app.com.http.parser.BannerParser;
import okhttp3.FormBody;

public class BannerReq implements HttpReq<BannerBean> {
    String type;

    public BannerReq(String type) {
        this.type = type;
    }

    @Override
    public void req(ReqCallback<BannerBean> callback) {//    /app/proxy/queryBanner
        FormBody.Builder builder = new FormBody.Builder();
        builder.add("nodeID", type);
        Req.post("/app/advertisement/retrieveBannerDetails", getParam(), getHeader(), builder.build(), new BannerParser(type), callback, this);
    }

    public BannerBean req() {
        FormBody.Builder builder = new FormBody.Builder();
        builder.add("nodeID", type);
        try {
            return Req.post("/app/advertisement/retrieveBannerDetails", getParam(), getHeader(), builder.build(), new BannerParser(type), this);
        } catch (Throwable e) {
            e.printStackTrace();
            return null;
        }
    }
}
